package com.example.demo.controller;

import com.example.demo.dto.OkDTO;
import com.example.demo.dto.PageDTO;
import com.example.demo.pojo.ElderlyBasicOk;
import com.example.demo.pojo.Result;
import com.example.demo.service.ElderlyBasicOkService;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("elderly/ok")
@Slf4j
@Tag(name = "老人接口")
@RequiredArgsConstructor
public class ElderlyBasicOkController {
    private final ElderlyBasicOkService elderlyBasicOkService;
    @PostMapping
    public Result ok(@RequestBody OkDTO okDTO) {
//        log.info("ok {}", elderlyOkDTO);
        elderlyBasicOkService.ok(okDTO);
        return Result.success();
    }
    @GetMapping
    public Result<List<ElderlyBasicOk>> getElderlyBasicOk(PageDTO pageDTO) {
        List<ElderlyBasicOk> elderLyBasicOkList = elderlyBasicOkService.getElderlyBasicOk(pageDTO);
        return Result.success(elderLyBasicOkList);
    }
}
